package com.ztesoft.web.baseconfig.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.ztesoft.core.common.Page;
import com.ztesoft.framework.exception.BaseAppException;
import com.ztesoft.framework.log.ZTEsoftLogManager;
import com.ztesoft.web.baseconfig.db.po.DmPlanPO;
import com.ztesoft.web.baseconfig.service.IMaintenanceService;

/**
 * <Description>文件计划草稿箱管理 <br>
 * 
 * @author lin.jie <br>
 * @version 1.0<br>
 * @taskId <br>
 * @CreateDate 2016年6月28日 <br>
 * @since V1.0<br>
 * @see com.ztesoft.web.baseconfig.controller <br>
 */

@Controller
@RequestMapping("/baseconfig/draft")
public class DraftController {

	private static final ZTEsoftLogManager logger = ZTEsoftLogManager.getLogger(DraftController.class);

	@Autowired
	private IMaintenanceService maintenanceService;

	@RequestMapping("index")
	@ResponseBody
	public ModelAndView index(Model model) {
		ModelAndView view = new ModelAndView("index");
		view.addObject("moduleMainView", "planmanage/draft/views/Draft");
		return view;
	}

	/**
	 * 执行计划维护--文件
	 * 
	 * @return
	 * @throws BaseAppException
	 */
	@RequestMapping("queryRecordByPage")
	@ResponseBody
	public Page<DmPlanPO> queryRecordByPage(DmPlanPO record, Page<DmPlanPO> resultPage) throws BaseAppException {
		resultPage = maintenanceService.queryRecordByPage(record, resultPage);
		return resultPage;
	}
}
